﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZBJF.Warranty.Common.Common;
using ZBJF.Warranty.Model;
using ZBJF.Warranty.Model.ViewModel.BaseQueryModel;
using ZBJF.Warranty.Model.ViewModel.InsuranceProducts;
namespace ZBJF.Warranty.BLL
{
    public partial class InsuranceProductWarrantyMaintenanceTypesService
    {
        //public bool IsExist(int tid, int yid, long id = 0)
        //{
        //    var expressionWhere = PredicateExtensions.True<InsuranceProductWarrantyMaintenanceTypes>();
        //    if (tid > 0)
        //        expressionWhere = expressionWhere.And(o => o.InsuranceProductId.Equals(tid) && o.InsuranceWarrantyMaintenanceTypeId.Equals(yid));
        //    if (id != 0)
        //        expressionWhere = expressionWhere.And(o => o.ID != id);
        //    return LoadEntities(expressionWhere).Any();
        //}

        /// <summary>
        /// 获取保险产品的服务项目可维修方式
        /// </summary>
        /// <param name="cellPhoneServiceProjectID">手机维修服务项目ID</param>
        /// <returns></returns>
        public IQueryable<InsuranceProductWarrantyMaintenanceTypes> GetInsuranceProductWarrantyMaintenanceTypesAll(int cellPhoneServiceProjectID)
        {
            return LoadEntities(o => o.CellPhoneServiceProjectID == cellPhoneServiceProjectID);
        }
        /// <summary>
        /// 获取产品所有服务项目线下的可维修方式
        /// </summary>
        /// <param name="cellPhoneServiceProjectIDs"></param>
        /// <returns></returns>
        public IQueryable<InsuranceProductWarrantyMaintenanceTypes> GetInsuranceProductWarrantyMaintenanceTypeList(List<int> cellPhoneServiceProjectIDs)
        {
            return LoadEntities(o => cellPhoneServiceProjectIDs.Contains(o.CellPhoneServiceProjectID));
        }
    }
}
